package com.jochen.core.assets

import com.badlogic.gdx.assets.AssetDescriptor
import com.badlogic.gdx.scenes.scene2d.ui.Skin
import com.jochen.core.tools.toInternalFile
import com.jochen.core.tools.findFirstFileWithExtension

enum class SkinAsset(
    private val skinName: String
) : Asset<Skin> {
    DEFAULT("default"),
    EARTH("earth"),
    GOLDEN("golden");

    override val descriptor: AssetDescriptor<Skin> = run {
        val file = "skin/$skinName".toInternalFile()
            .findFirstFileWithExtension("json")
            ?: throw IllegalStateException("没有Skin资源: $skinName")
        
        AssetDescriptor(file, Skin::class.java)
    }
}